export default {
    'edc.excel.tableInsertLeftCol': function () {
        const sheet = this.workbook.getActiveSheet();
        const row = sheet.getActiveRowIndex();
        const col = sheet.getActiveColumnIndex();
        const table = sheet.tables.find(row, col);
        if (table) {
            const actionName = 'edc.excel.tableInsertCol';
            this.workbook.commandManager().execute({
                autoFitType: GC.Spread.Sheets.AutoFitType.cell,
                cmd: actionName,
                sheet,
                sheetName: sheet.name(),
                col: col - 1,
                table
            });
        }
    }, 'edc.excel.tableInsertRightCol': function () {
        const sheet = this.workbook.getActiveSheet();
        const row = sheet.getActiveRowIndex();
        const col = sheet.getActiveColumnIndex();
        const table = sheet.tables.find(row, col);
        if (table) {
            const actionName = 'edc.excel.tableInsertCol';
            this.workbook.commandManager().execute({
                autoFitType: GC.Spread.Sheets.AutoFitType.cell,
                cmd: actionName,
                sheet,
                sheetName: sheet.name(),
                col,
                table
            });
        }
    }, 'edc.excel.tableInsertTopRow': function () {
        const sheet = this.workbook.getActiveSheet();
        const row = sheet.getActiveRowIndex();
        const col = sheet.getActiveColumnIndex();
        const table = sheet.tables.find(row, col);
        if (table) {
            const actionName = 'edc.excel.tableInsertRow';
            this.workbook.commandManager().execute({
                autoFitType: GC.Spread.Sheets.AutoFitType.cell,
                cmd: actionName,
                sheet,
                sheetName: sheet.name(),
                row: row,
                table
            });
        }
    }, 'edc.excel.tableInsertBottomRow': function () {
        const sheet = this.workbook.getActiveSheet();
        const row = sheet.getActiveRowIndex();
        const col = sheet.getActiveColumnIndex();
        const table = sheet.tables.find(row, col);
        if (table) {
            const actionName = 'edc.excel.tableInsertRow';
            this.workbook.commandManager().execute({
                autoFitType: GC.Spread.Sheets.AutoFitType.cell,
                cmd: actionName,
                sheet,
                sheetName: sheet.name(),
                row: row + 1,
                table
            });
        }
    }, 'edc.excel.tableDeleteCol': function () {
        const sheet = this.workbook.getActiveSheet();
        const row = sheet.getActiveRowIndex();
        const col = sheet.getActiveColumnIndex();
        const table = sheet.tables.find(row, col);
        if (table) {
            const actionName = 'edc.excel.tableDeleteCol';
            this.workbook.commandManager().execute({
                autoFitType: GC.Spread.Sheets.AutoFitType.cell,
                cmd: actionName,
                sheet,
                sheetName: sheet.name(),
                col,
                table
            });
        }
    }, 'edc.excel.tableDeleteRow': function () {
        const sheet = this.workbook.getActiveSheet();
        const row = sheet.getActiveRowIndex();
        const col = sheet.getActiveColumnIndex();
        const table = sheet.tables.find(row, col);
        if (table) {
            const actionName = 'edc.excel.tableDeleteRow';
            this.workbook.commandManager().execute({
                autoFitType: GC.Spread.Sheets.AutoFitType.cell,
                cmd: actionName,
                sheet,
                sheetName: sheet.name(),
                row,
                table
            });
        }
    }
}